/*
 * XML Type:  XMenuManager
 * Namespace: http://www.seedwill.com/xul/widget/
 * Java type: com.seedwill.xul.widget.XMenuManager
 *
 * Automatically generated - do not modify.
 */
package com.seedwill.xul.widget.impl;
/**
 * An XML XMenuManager(@http://www.seedwill.com/xul/widget/).
 *
 * This is a complex type.
 */
public class XMenuManagerImpl extends com.seedwill.xul.core.impl.XIdentifiedImpl implements com.seedwill.xul.widget.XMenuManager
{
    private static final long serialVersionUID = 1L;
    
    public XMenuManagerImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName MENU$0 = 
        new javax.xml.namespace.QName("", "menu");
    private static final javax.xml.namespace.QName MENUBAR$2 = 
        new javax.xml.namespace.QName("", "menuBar");
    
    
    /**
     * Gets array of all "menu" elements
     */
    public com.seedwill.xul.widget.XMenu[] getMenuArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(MENU$0, targetList);
            com.seedwill.xul.widget.XMenu[] result = new com.seedwill.xul.widget.XMenu[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "menu" element
     */
    public com.seedwill.xul.widget.XMenu getMenuArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenu target = null;
            target = (com.seedwill.xul.widget.XMenu)get_store().find_element_user(MENU$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "menu" element
     */
    public int sizeOfMenuArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(MENU$0);
        }
    }
    
    /**
     * Sets array of all "menu" element
     */
    public void setMenuArray(com.seedwill.xul.widget.XMenu[] menuArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(menuArray, MENU$0);
        }
    }
    
    /**
     * Sets ith "menu" element
     */
    public void setMenuArray(int i, com.seedwill.xul.widget.XMenu menu)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenu target = null;
            target = (com.seedwill.xul.widget.XMenu)get_store().find_element_user(MENU$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(menu);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "menu" element
     */
    public com.seedwill.xul.widget.XMenu insertNewMenu(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenu target = null;
            target = (com.seedwill.xul.widget.XMenu)get_store().insert_element_user(MENU$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "menu" element
     */
    public com.seedwill.xul.widget.XMenu addNewMenu()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenu target = null;
            target = (com.seedwill.xul.widget.XMenu)get_store().add_element_user(MENU$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "menu" element
     */
    public void removeMenu(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(MENU$0, i);
        }
    }
    
    /**
     * Gets array of all "menuBar" elements
     */
    public com.seedwill.xul.widget.XMenuBar[] getMenuBarArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(MENUBAR$2, targetList);
            com.seedwill.xul.widget.XMenuBar[] result = new com.seedwill.xul.widget.XMenuBar[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "menuBar" element
     */
    public com.seedwill.xul.widget.XMenuBar getMenuBarArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenuBar target = null;
            target = (com.seedwill.xul.widget.XMenuBar)get_store().find_element_user(MENUBAR$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "menuBar" element
     */
    public int sizeOfMenuBarArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(MENUBAR$2);
        }
    }
    
    /**
     * Sets array of all "menuBar" element
     */
    public void setMenuBarArray(com.seedwill.xul.widget.XMenuBar[] menuBarArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(menuBarArray, MENUBAR$2);
        }
    }
    
    /**
     * Sets ith "menuBar" element
     */
    public void setMenuBarArray(int i, com.seedwill.xul.widget.XMenuBar menuBar)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenuBar target = null;
            target = (com.seedwill.xul.widget.XMenuBar)get_store().find_element_user(MENUBAR$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(menuBar);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "menuBar" element
     */
    public com.seedwill.xul.widget.XMenuBar insertNewMenuBar(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenuBar target = null;
            target = (com.seedwill.xul.widget.XMenuBar)get_store().insert_element_user(MENUBAR$2, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "menuBar" element
     */
    public com.seedwill.xul.widget.XMenuBar addNewMenuBar()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.widget.XMenuBar target = null;
            target = (com.seedwill.xul.widget.XMenuBar)get_store().add_element_user(MENUBAR$2);
            return target;
        }
    }
    
    /**
     * Removes the ith "menuBar" element
     */
    public void removeMenuBar(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(MENUBAR$2, i);
        }
    }
}
